try:
  from xml.etree import ElementTree # for Python 2.5 users
except ImportError:
  from elementtree import ElementTree
import gdata.calendar.service
import gdata.service
import atom.service
import gdata.calendar
import atom
import getopt
import sys
import string
import time
import wx
import urllib2
import getpass

#http://code.google.com/p/gdata-python-client/source/browse/trunk/samples/calendar/calendarExample.py

def main():
	print 'hello world'
	user_name = raw_input("Enter username: ")
	user_password = getpass.getpass("Enter password: ")
	
	calendar_service = gdata.calendar.service.CalendarService()
	calendar_service.email = user_name+'@gmail.com'
	calendar_service.password = user_password
	calendar_service.source = 'CSE40232-Scheduler-0.1'
	calendar_service.ProgrammaticLogin()
	
	feed = calendar_service.GetCalendarEventFeed()
	print 'Events on Primary Calendar: %s' % (feed.title.text,)
	for i, an_event in zip(xrange(len(feed.entry)), feed.entry):
		print '\t%s. %s' % (i, an_event.title.text,)
		for p, a_participant in zip(xrange(len(an_event.who)), an_event.who):
			print '\t\t%s. %s' % (p, a_participant.email,)
			print '\t\t\t%s' % (a_participant.name,)
			if a_participant.attendee_status:
				print '\t\t\t%s' % (a_participant.attendee_status.value,)


 
if __name__ == '__main__':
	main()